<!doctype html>
<html>
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width,initial-scale=1">

    <?php include_once MvcReg::$_moduleName . '/views/layout/head.php'; ?>

</head>
<body>
<?php include_once MvcReg::$_moduleName . '/views/layout/woody-prompt.php'; ?>
<?php include_once MvcReg::$_moduleName . '/views/layout/header.php'; ?>
<div id="main">
    <div class="container-fluid">
        <div class="row">
            <div class="col-md-2">
                <?php include_once MvcReg::$_moduleName . '/views/layout/left_menu.php'; ?>
            </div>
            <div class="col-md-10">
                <div class="right-content">
                    <h3>
                        <ol class="breadcrumb">
                            <li><a href="?md=company&cl=store&at=storelist"><i class="fa fa-dashboard"></i><?php echo $menu["breadcrumb_current"] ?></a></li>
                        </ol>
                    </h3>
                    <br>
                    <form name="mainform" action="" method="get">
                    <?php echo $hidden_data?>
                    <div class="table-responsive">
                        <div class="panel panel-default">
                            <div class="panel-body form-inline">

                                <div class="form-group">
                                    <label>门店编号/名称:</label>
                                    <input type="text" name="query" value="<?php echo $query ?>" class="form-control input-sm" placeholder=""/>
                                </div>

                                <div class="form-group">
                                    <label>营业状态:</label>
                                    <?php echo Tools::selectOptions("business_status", Data::$_store_business_status, '全部', true, $business_status, 'class="form-control select"'); ?>
                                </div>

                                    <button type="submit" class="btn btn-primary"><span class="glyphicon glyphicon-search"></span>立即查询</button>
                                <div class="col-sm-2" style="float: right">
                                    <div class="dataTables_filter">
                                        <a href="javascript:;" onclick="exp('<?php echo $query ?>','<?php echo $business_status ?>')" class="btn btn-primary"><b>汇出</b></a>
                                    </div>
                                </div>

                            </div>
                        </div>

                        <table class="table table-hover">
                            <thead>
                            <tr class="info">
                                <th>序</th>
                                <th>门店编号</th>
                                <th>门店名称</th>
                                <th>电话</th>
                                <th>地址</th>
                                <th>在线状态</th>
                                <th>状态</th>
                                <th>功能</th>
                            </tr>
                            </thead>
                            <tbody>
                            <?php
                            $n = 0;
                            foreach ($rsp_list as $k => $row) {
                                $n++;
                                $item = $n + ($page - 1) * $number_page;
                                $id = $row["id"];

                                if ($row['zp_status'] == 0) {
                                    $status_btn = "%{ONLINE}%";
                                    $status = "<label class='red'>%{OFFLINE}%</label>";
                                } else {
                                    $status_btn = "%{OFFLINE}%";
                                    $status = "%{ONLINE}%";
                                }
                                ?>
                                <tr data-id="<?php echo $id?>">
                                    <td><?php echo $item ?></td>
                                    <td><?php echo $row["store_id"] ?></td>
                                    <td><?php echo $row["storename"] ?></td>
                                    <td><?php echo $row["tel"] ?></td>
                                    <td><?php echo $row["front_province"].$row["front_city"].$row["front_area"].$row["front_address"] ?></td>
                                    <td><?php echo $status ?></td>
                                    <td><?php echo Data::$_store_business_status[$row['business_status']] ?></td>
                                    <td><input name="input" value="编辑"
                                           onclick="edit('<?php echo $row['id']; ?>', '<?php echo $page; ?>','<?php echo $this_url?>edit')"
                                           type="button" class="btn btn-success btn-sm"/>


                                        <input name="input" value="<?php echo $status_btn ?>"
                                               onclick="changeStatus('<?php echo $id; ?>', '<?php echo $page; ?>','<?php echo $this_url?>')"
                                               type="button" class="btn btn-success btn-sm"/>
                                    </td>
                                </tr>
                            <?php } ?>
                            </tbody>
                        </table>
                        <div class="page">
                                <div class="pagination pull-left">共<?php echo $total_count ?>笔记录</div>
                                <?php if (!empty($rsp_page_list)) echo $rsp_page_list; ?>
                        </div>
                    </div>
                    </form>
                </div>
            </div>
        </div>
    </div>
</div>
<!--<script src="webroot/common/chosen/chosen.jquery.js"></script>-->
<?php include_once MvcReg::$_moduleName . '/views/layout/footer.php'; ?>
<script>
    function exp(q,b) {
        window.location.href = "?md=company&cl=store&at=exportStore&query="+q+"&business_status="+b;
    }
</script>
</body>
</html>
